﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UIManager : MonoBehaviour
{
    private static UIManager _instance;
    public static UIManager Instance { get { return _instance; } }

    private void Awake()
    {
        _instance = this;
        InitWidget();
        Init();
    }

    private GameObject _playerShade;

    private void InitWidget()
    {
        _playerShade = transform.Find("PlayerShadeImg").gameObject;
    }

    private void Init()
    {
        ShadeImgActive(false);
    }

    /// <summary>
    /// 阴影图片设置显示.
    /// </summary>
    /// <param name="state"></param>
    public void ShadeImgActive(bool state)
    {
        _playerShade.SetActive(state);
    }

    private readonly Vector2 _shadeOffset = new Vector2(0, -101.8f);

    public void ShowShade(Vector2 pos)
    {
        _playerShade.SetActive(true);
        _playerShade.transform.position = pos + _shadeOffset;
    }
}
